package com.yesep.learn.design.behavioral.state;

public class LightContext {
    private LightState currentState;

    public LightContext() {
        currentState = LightState.RED;
    }

    public void change(LightState state) {
        currentState = state;
        System.out.printf("Current light is %s.\n", state.name());
    }

    public void toggle() {
        currentState.getState().handle(this);
    }
}